/*
관련파일 : before_worker.html
*/
//prototype Function
function $(id)
{
	return document.getElementById(id);
};
function Init()
{	
	var a=0;
	var str='';
	var flag=false;
	$('startBtn').onclick = function()
	{
		flag = true;
		if(flag)
		{
			for(i=0; i<999; i++)
			{
				a = parseInt(a+1);
				str += a + "<br>"
				$('result').innerHTML = str;
			}
		}
	};
	
	$('stopBtn').onclick = function()
	{
		flag=false;		
	};
	var w;
	$('wor_startBtn').onclick = function()
	{	
		w = new Worker('../js/gugudan.js');
		w.onmessage = checkMessage;
	};
	$('wor_stopBtn').onclick = function()
	{
		w.terminate();
	};

	var w2;
	$('wor_p_startBtn').onclick = function()
	{	
		w2 = new Worker('../js/plus.js');
		w2.onmessage = checkMessage2;
	};
	$('wor_p_stopBtn').onclick = function()
	{
		w2.terminate();
	};
}

function checkMessage(ev)
{
	r = $('wor_result');
	r.innerHTML = ev.data;
}
function checkMessage2(ev)
{
	r = $('wor_p_result');
	r.innerHTML = ev.data;
}
